<template>
    <div class="view_con">
        <ul class="n_list" v-if="art.length>0">
            <li class="n_item" v-for="item in art" :key="item.id">
                <a :href="'#/detail?id='+item.id+'&name=工作动态&url=#/work/active'">
                    <div class="left">
                        <div class="time">
                            <div class="year">{{item.update_time.slice(0,item.update_time.indexOf('-'))}}</div>
                            <div class="date">{{item.update_time.slice(item.update_time.indexOf('-')+1,item.update_time.indexOf(' '))}}</div>
                        </div>
                        <div class="info">
                            <div class="n_title">
                                {{item.title}}
                            </div>
                            <div class="heng"></div>
                            <div class="con_des">
                                {{item.describe}}
                            </div>
                        </div>
                    </div>
                    <div class="right_btn">
                        <img src="/static/images/right.png" alt="">
                    </div>
                </a>
            </li>
            <!-- <el-pagination
            background
            layout="prev, pager, next"
            :page-size="10"
            :total="total">
            </el-pagination> -->
        </ul>
        <el-empty v-else></el-empty>
    </div>
</template>

<script>
export default {
    data() {
        return {
           art:[],
            total:0
        };
    },

    mounted() {
        this.getdata()
    },
    watch:{
        $route:{
            handler(newval,oldval){
                this.type = newval.query.type
                this.getdata()
            },
            deep:true,
            immediate:true
        }
    },
    methods: {
        getdata(){
            this.$api.post('getArticleList',{
                "searchKey":"",
                    "sort":"sort",
                    limit:100,
                    "type":'工作动态'
            }).then(res=>{
                let arr = []
                res.data.list.forEach(item => {
                   if(item.belong == this.type){
                    arr.push(item)
                   } 
                });
                this.art = arr
                console.log(arr,this.art)
            })
        }
    },
};
</script>

<style lang="scss" scoped>
   @import  '@/assets/css/common.scss';
   
</style>